<div id="content-flash">
    <?php if($this->session->flashdata('article') != null){ ?>
    <p id="content-notif">
        <?php
        echo $this->session->flashdata('article');
        ?>
    </p>
    <?php } ?>
</div>
<div id="content-title">
    <p id="ctitle-p">
        List Article
    </p>
</div>
<div class="hor-line"></div>
<div id="content">
    <div id="user-menu">
        <div id="add-article">
            <a href="<?php echo base_url().'cp/add_article/';?>">
                + Add Article
            </a>
        </div>
    </div>
    <table id="table-article">
        <tr class="tr-title">
            <td class="td-no">
                No
            </td>
            <td class="td-title">
                Title
            </td>
            <td class="td-category">
                Category
            </td>
            <td class="td-date">
                Post Date
            </td>
            <td class="td-author">
                Author
            </td>
            <td class="td-published">
                Published
            </td>
            <td class="td-action">
                Action
            </td>
        </tr>
        <?php 
        $count = 1;
        foreach($article->result() as $row){
        ?>
        <tr <?php echo (($count % 2) == 0) ? 'class="tr-round"' : '';?>>
            <td class="td-no"><?php echo $count;?></td>
            <td class="td-title"><?php echo $row->title;?></td>
            <td class="td-category"><?php echo $row->category_name;?></td>
            <td class="td-date"><?php echo $row->post_date;?></td>
            <td class="td-author"><?php echo $row->name;?></td>
            <td class="td-published"><?php echo ($row->published) ? 'Yes' : 'No';?></td>
            <td class="td-action">
                <a href="<?php echo base_url().'cp/edit_article/'.$row->article_id;?>">
                    Edit
                </a>
                <a href="<?php echo base_url().'article/delete/'.$row->article_id;?>">
                    Delete
                </a>
            </td>
        </tr>
        <?php
            $count++;
        }
        ?>
    </table>
</div>